from os import path

print('获取文件绝对路径：', path.abspath('./new.txt'))
print('文件在磁盘是否存在', path.exists('new.txt'))
print('文件在磁盘是否存在', path.exists('new1.txt'))

print('拼接：', path.join('/Users/liuqiong/Desktop/lq/py-demo/basic-demo/chap7-file', 'new.txt'))
print('分割文件和后缀', path.splitext('new.txt'))
print('提取文件名', path.basename('/Users/liuqiong/Desktop/lq/py-demo/basic-demo/chap7-file/new.txt'))
print('提取路径', path.dirname('/Users/liuqiong/Desktop/lq/py-demo/basic-demo/chap7-file/new.txt'))

print(path.isdir('/Users/liuqiong/Desktop/lq/py-demo/basic-demo/chap7-file'))

print(path.isfile('new.txt'))




